export { }

// 类型别名,对已知的类型定义别名
type User = { name: string, age: number }
// let u:{ name: string, age: number }
let u: User

let userArr: { name: string, age: number }[]

// 类型别名不许重复定义,接口可以
interface myUser {
  name: string
  show(): void
}
interface myUser {
  age: number
}
let u2: myUser
u2 = {
  name: "张三", age: 10, show() {
    console.log(111);
  },
}

// 规定类的结构
interface ClockInterface {
  currentTime: Date;
}

class Clock implements ClockInterface {
  currentTime: Date;
  constructor(h: number, m: number) { }
}

// 规定构造函数的类型
interface ClockConstructor {
  new (hour: number, minute: number);
}

// class Clock implements ClockConstructor {
//   currentTime: Date;
//   constructor(h: number, m: number) { }
// }



function fn1(num: number): number {
  return 10
}

function fn2<T>(num: T): T {
  return num
}

fn2(10)
fn2<string>("111")